<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .item{
            width: 300px;
            height: 300px;
            background: deeppink;
        }
    </style>
</head>
<body>
    <!-- <div>我是一个div</div>
    <div class="item"></div> -->
    <button>按钮</button>
    <div class="item">

    </div>
<script src="js/jquery-3.6.0.min.js"></script>
<script>
$(function(){
    // $('div').addClass('box');
    // $('div').removeClass('item');
    $('button').click(function(){
        $('div').toggleClass('item');
    })

})
</script>
</body>
</html>